package com.example.lp.contentprovider;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;


/**
 * Author by lp,on 2021/2/22/022,15:53.
 */
public class MyDbHelper extends SQLiteOpenHelper {

    private static final String TAG="MyDbHelper";
    private static final String DB_NAME="providerDb";
    private static final int DB_VERSION=2;
    public  static final String BOOK_TABLE="book";

    private String CREATE_BOOK_TABLE="CREATE TABLE IF NOT EXISTS " +BOOK_TABLE
            +"( _id INTEGER PRIMARY KEY, name  TEXT)";


    public MyDbHelper(Context context){
        super(context,DB_NAME,null,DB_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        Log.i(TAG, "onCreate: ");
        db.execSQL(CREATE_BOOK_TABLE);

    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        Log.i(TAG, "onUpgrade: oldVersion "+oldVersion);
        Log.i(TAG, "onUpgrade: newVersion "+newVersion);

    }
}
